<%--
  Created by IntelliJ IDEA.
  User: 狗崽
  Date: 2022/2/20
  Time: 17:24
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Update By Self</title>
    <!--<link rel="stylesheet" href="./IDTestCSS.css">-->
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
    <style type="text/css">
        body{
            background-color: #e4b9c0;
        }

        #msform{
            width: 400px;
            margin: 50px auto;
            text-align: center;
            position: relative;
        }

        /*inputs*/
        #msform input{
            padding: 15px;
            border: 2px solid #E6E6FA;
            border-radius: 3px;
            margin-bottom: 10px;
            width: 100%;
            box-sizing: border-box;
            font-family: montserrat;
            color: #2C3E50;
            font-size: 13px;
        }
        /*buttons*/
        #msform button {
            width: 400px;
            background: #F5F5F5;
            font-weight: bold;
            color: white;
            border: 2px solid #E6E6FA;
            /*border-radius: 1px;*/
            cursor: pointer;
            padding: 10px 5px;
            margin: 10px 5px;
            height: 45px;
            text-align: center;
        }

    </style>
</head>
<body>

<div class="nav"></div>
<div class="container">

    <form id="msform" name="steam" onsubmit="return bug()" action="/alter" method="get" >
        <div class="group">
            <input type="text" name="Name" placeholder="Enter the Name">
            <br>
            <br>
            <input type="text"  name="ID" placeholder="Enter the ID">
            <br>
            <br>
            <input type="text" name="Data" placeholder="Enter the Data"]>
            <br>
            <br>
            <input type="text" name="Number" placeholder="Enter the Number">
            <br>
            <br>
            <input type="text" name="Status" placeholder="Enter the Status">
            <br>
            <br>
            <input type="text" name="Term" placeholder="Enter the Term">
            <br>
            <br>
            <input type="submit" value="确定">
            <button type="button" ><a href="/student">取消</a></button>
            <span class="highlight"></span>
            <span class="bar"></span>
        </div>
    </form>

</div>

</body>
<script type="text/javascript">
    function bug(){
        var name = document.steam.Name.value;
        var id = document.steam.ID.value;
        var data = document.steam.Data.value;
        var number = document.steam.Number.value;
        var status = document.steam.Status.value;
        var term = document.steam.Term.value;

        var names = /[a-zA-Z]$/;
        var ids = /^\d{6}$/;
        var datas = /^\d{8}/;
        var numbers = /^1\d{10}$/;
        var statuss = /[AL]/;
        var terms = /[1-8]/;
        if(!names.test(name)){
            alert("用户名不合法");
            return false;
        }
        if(!ids.test(id)){
            alert("id不合法");
            return false;
        }
        if(!datas.test(data)){
            alert("日期格式不正确");
            return false;
        }
        if(!numbers.test(number)){
            alert("手机号格式不正确");
            return false;
        }
        if(!statuss.test(status)){
            alert("状态应为A或L");
            return false;
        }
        if(!terms.test(term)){
            alert("学期格式不正确");
            return false;
        }
     }

</script>
</html>
